[TorchToTosa] Lower bool bitwise ops to logical ops#4490
Open
[TorchToTosa] Lower bool bitwise ops to logical ops#4490
Conversation
TOSA bitwise_* ops do not accept i1 tensors. When aten.bitwise_* is applied to bool tensors, lower to tosa.logical_and/or/xor instead. Add a conversion test for bool bitwise_and. Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: I98e0ae72f69c926abe97c036489bf2e39ba6f88f
Contributor
Author
sahas3
approved these changes
Mar 9, 2026
Comment on lines
+755
to
+758
| auto lhsBool = | ||
| tosa::tosaCastTensorToType(rewriter, lhs, resultTy).value(); | ||
| auto rhsBool = | ||
| tosa::tosaCastTensorToType(rewriter, rhsTensor, resultTy).value(); |
Member
There was a problem hiding this comment.
Are these casts necessary? Won't the operand types already be same as the result type for the ops under consideration?
Member
There was a problem hiding this comment.
@catcor01 Can you please clarify this question? Thanks!
Change-Id: If46ca296d3d4fbd27ed5f39ed88a17825a23aa4f Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Change-Id: I8770a509a395145fae78cbcc93320279a4c25de9 Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
983e5b0 to
8911a85
Compare
Change-Id: I0c4e3b06d550efa0995fe5e4d5170a6852c2c948 Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Change-Id: Ib55aaccd05bb09e8815dd2c68eb235c37504f3f4 Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TOSA bitwise_* ops do not accept i1 tensors. When aten.bitwise_* is applied to bool tensors, lower to tosa.logical_and/or/xor instead. Add a conversion test for bool bitwise_and.
Change-Id: I98e0ae72f69c926abe97c036489bf2e39ba6f88f